<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Core_Plugin_Installer extends Zend_Controller_Plugin_Abstract
{
  public function routeStartup(Zend_Controller_Request_Abstract $request)
  {
    //$this->getResponse()->appendBody("<p>routeStartup() called</p>\n");
  }
 
  public function routeShutdown(Zend_Controller_Request_Abstract $request)
  {
    $tables = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('db')->listTables();
    if((count($tables)<2) && ($request->getModuleName()!=='installer'))
    {
      Zend_Controller_Action_HelperBroker::getStaticHelper('redirector')->gotoUrl('installer/index/index');
    }
    //$this->getResponse()->appendBody("<p>routeShutdown() called</p>\n");
  }
 
  public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
  {
    //$this->getResponse()->appendBody("<p>dispatchLoopStartup() called</p>\n");
  }

  public function preDispatch(Zend_Controller_Request_Abstract $request)
  {
    //$this->getResponse()->appendBody("<p>preDispatch() called</p>\n");
  }

  public function postDispatch(Zend_Controller_Request_Abstract $request)
  {
    //$this->getResponse()->appendBody("<p>postDispatch() called</p>\n");
  }

  public function dispatchLoopShutdown()
  {
    //$this->getResponse()->appendBody("<p>dispatchLoopShutdown() called</p>\n");
  }
}